וַיַּ֣רְא כָּל־יִשְׂרָאֵ֗ל כִּ֠י לֹֽא־שָׁמַ֣ע הַמֶּלֶךְ֮ אֲלֵיהֶם֒ וַיָּשִׁ֣בוּ הָעָ֣ם אֶת־הַמֶּ֣לֶךְ דָּבָ֣ר ׀ לֵאמֹ֡ר מַה־לָּנוּ֩ חֵ֨לֶק בְּדָוִ֜ד וְלֹֽא־נַחֲלָ֣ה בְּבֶן־יִשַׁ֗י לְאֹהָלֶ֙יךָ֙ יִשְׂרָאֵ֔ל עַתָּ֕ה רְאֵ֥ה בֵיתְךָ֖ דָּוִ֑ד וַיֵּ֥לֶךְ יִשְׂרָאֵ֖ל לְאֹהָלָֽיו׃
און װי גאַנץ ישׂראל האָט געזען, אַז דער מלך האָט ניט צוגעהערט צו זײ, אַזױ האָט דאָס גאַנצע פֿאָלק געגעבן דעם מלך אַן ענטפֿער, אַזױ צו זאָגן: מיר האָבן ניט קײן חלק אין דָוִדן, און קײן ירושה אין דעם זון פֿון יִשַין. צו דײַנע געצעלטן, ישׂראל ! אַצונד קוק זיך אום אױף דײַן הױז, דוד! און ישׂראל איז אַװעקגעגאַנגען צו זײַנע געצעלטן.
Mekhilta DeRabbi Yishmael
The eighth, that of Solomon, viz. (Psalms 30:1) "A psalm, a song of the inauguration of the Temple of David." Now did David built it? Did not Solomon build it? viz. (I Kings 6:14) "And Solomon built the Temple." Why, then, is it written "A psalm, a song of the inauguration of the Temple of David? But because David devoted his life to building it, it was called by his name. Similarly, (Psalms 132:1-6) "Remember, O L–rd, unto David, al of his tribulation (in seeking a place for Your sanctuary), which, (to find the place,) he swore to the L–rd, vowed to the Strength of Jacob: Forefend that I came to the test of my habitation (my palace), that I go up on the bed spread out before me, that I give (superfluous) sleep to my eyes or slumber to my lids, before I find the (fore-ordained) place for (the Temple of) the L–rd, the habitation of the Strength of Jacob. We had heard it (that place) to be in Efrat (the most select of places), and, lo, we have found it in the fields of the forest (in the boundary of Benjamin, who is likened to a beast of the forest" [viz. Genesis 49:27]). And what is written afterwards? (I Kings 12:16) "See your house, O David." Because David devoted his life to it, it was called by his name. And thus you find that whatever a man devotes his life to is called by his name.
Mekhilta DeRabbi Yishmael
R. Yehudah says: It is not written "the pupil of the eye, but "the pupil of His eye" — the "eye" of the Holy One, as it were. Similarly, (Malachi 1:13) "And you say (of an offering) 'What a burden it is!' and you (thereby) sully it." It is actually written "Him," but Scripture here is euphemistic. Similarly, (I Samuel 3:13) "because of his knowing that his sons were blaspheming them and his not censuring them" — a euphemism (for "Me"). Similarly, (Iyyov 7:20) "Why did You make me a target for Yourself and a burden to myself" — a euphemism (for "You"). Similarly (Habakkuk 1:12) "Are You not of yore, O L–rd my G–d, my Holy one — we shall not die" — a euphemism (for "You"). Similarly, (Jeremiah 2:11) "Has a nation ever exchanged (its) god though they be no god? Yet My people has exchanged its glory" — a euphemism (for "My"). Similarly, (Psalms 106:20) "And they exchanged their glory for the image of an ox, etc." — a euphemism (for "Your"). (Numbers 11:15) "and let me not see my misfortune" — a euphemism (for "their"). Similarly, (II Samuel 20:1) "We have no portion in David … Each man to his tent ("ohalav"), O Israel" — a euphemism (for "god" ["elohav"]). (Ezekiel 8:17) "And, behold, they thrust the branch to their nostrils" — a euphemism (for "My"). (Numbers 12:13) "who leaves his mother's womb" — a euphemism (for "our"). Here, (Zechariah 2:12) likewise, "One who touches him (a Jew) touches the pupil of his eye"
Midrash Tanchuma
This song. Is there only one song? Was it not stated previously that there were ten songs? The eighth song is A psalm, a song at the dedication of the house, of David (Ps. 30:1). The fact is that Solomon was the one who dedicated it, as it is said: So the king and all the children of Israel dedicated the house of the Lord (I Kings 8:63). However, because David had set his heart upon dedicating it, the song was ascribed to him. Similarly, it says: Lord, remember unto David all his afflictions; how he swore unto the Lord, and vowed unto the Mighty One of Jacob: “Surely I will not come into the tent of my house, nor go up into the bed that is spread for me … until I find out a place for the Lord, a dwelling-place for the Mighty One of Jacob.” Lo, we heard it as being in Ephrath; we found it in the field of the wood (Ps. 132:1–6). Observe that it is written concerning it: Now see to this house, O David (I Kings 12:16). Hence you learn that because David desired with all his soul to build the Temple, it was called by his name.